{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}

    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>管理信息</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('Index/index')}">主页</a>
                    </li>
                    <li>
                        <a>权限</a>
                    </li>
                    <li>
                        <strong>管理列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>管理列表</h5>
                            <div class="ibox-tools">
                                <small>共 {$Count} 条</small>
                            </div>
                        </div>

                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <a href="javascript:;" onclick="admin_add('添加管理','{:url("Admin/AdminAdd")}','800','492')" class="btn btn-sm btn-primary"> 添加管理</a>
                                    </div>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>管理账号</th>
                                        <th>管理姓名</th>
                                        <th>管理手机</th>
                                        <th>所属角色</th>
                                        <th>添加时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="AdminList" id="v"}
                                    <tr>
                                        <td>{$key+1}</td>
                                        <td>{$v.username}</td>
                                        <td>{$v.name}</td>
                                        <td>{$v.phone}</td>
                                        <td>{$v.role_name}</td>
                                        <td>{$v.add_time|date="Y-m-d H:i:s",###}</td>
                                        <td>
                                            <a title="管理编辑" href="javascript:;" onclick="admin_edit('管理编辑','{:url("Admin/AdminEdit",["id"=>$v["id"]])}','800','443')"><i class="fa fa-edit text-navy"></i></a>
                                            <a title="重置密码" href="javascript:;" onClick="admin_pas(this,{$v.id})"><i class="fa fa-mail-reply-all text-navy"></i></a>
                                            <a title="管理删除" href="javascript:;" onClick="admin_del(this,{$v.id})"><i class="fa fa-trash text-navy"></i></a>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}

    </div>
</div>
</div>
{include file="public/footer"}
<script>
    /*管理-增加*/
    function admin_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*管理-编辑*/
    function admin_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*管理-重置密码*/
    function admin_pas(obj,id){
        layer.confirm('确认要重置密码吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Admin/AdminPassword')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }

    /*管理-删除*/
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Admin/AdminDelete')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }
</script>
</body>
</html>
